#!/bin/bash

# modify this prefix to get kth fold
if [ $# -ne 2 ]
then
  echo "Usage:<PRE> <numround>"
  exit -1
fi

PRE=$1
cd ..
make buffer.u$PRE.test.ufcut
make buffer.u$PRE.train.ufcut
cd -
rm -rf *.model

start=0
nround=$2

for(( i=$start; i < $nround; i ++ ))
do    
# run training, use different seed to ensure different kinds of pos/neg pair in each round
    $CODEPATH/svdf_gfmf config.conf max_round=1 num_round=$nround start_counter=$i continue=1 buffer_feature=../buffer.u$PRE.train.ufcut 
    $CODEPATH/svdf_gfmf_infer config.conf focus=$((i+1)) silent=1 > stats.txt test:buffer_feature=../buffer.u$PRE.test.ufcut 
# record results in log
    cat stats.txt
    mv log.txt log 2>/dev/null
    cat log stats.txt > log.txt 2>/dev/null
    rm -f log stats.txt pred.txt
done

